Pin jQuery version in generated docs pages - #46
Merged
semihakbayrak merged 1 commit intoJul 14, 2026
Conversation
Add an mkdocs on_post_page hook that normalises the jQuery version referenced by rendered notebook pages (injected by the mknotebooks widget renderer) to a single current, pinned release (3.7.1). The hook lives outside docs/ so it is not published as a static asset and runs on every mkdocs build.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Pins the jQuery version referenced by the rendered notebook pages of the documentation site to a single current release.
Background
The
mknotebooksplugin injects a Jupyter-widgets renderer snippet into each rendered notebook page (basic,placebo_test,azcausal). That snippet references an older jQuery release from a CDN. This normalises it to a consistent, current version.Change
on_post_pagehook (hooks/pin_jquery_version.py) that rewrites older jQuery references in the generated HTML to a pinned 3.7.1.ajax/libs/jquery/x.y.z/jquery.min.js) and code.jquery.com (jquery-x.y.z.min.js) URL forms; leaves current versions and non-jQuery scripts untouched.docs/so the hook source is not published as a static asset.hooks:inmkdocs.yml; runs on everymkdocs build/deploy.Testing
Built the docs locally and compared the generated HTML with and without the hook:
examples/azcausal/index.htmlexamples/basic/index.htmlexamples/placebo_test/index.htmlWith the hook, all rendered pages reference jQuery 3.7.1 and no reference below 3.5.0 remains anywhere in the built site. The control build (hook removed) confirms the pinning is what changes the output.